# 构成键对
import random
random.seed(1)
student = {chr(i): random.randint(35, 100) for i in range(65, 80)}
print(student)
# 按照学生成绩降序排列输出字典
studentrank = sorted(student.items(), key=lambda x: x[1], reverse=True)
# 统计不及格人数的个数
nopass = len([score for score in student.values() if score < 60])
print(f"不及格人数：{nopass}")
# 计算学生成绩平均分、最大值、最小值
avg = sum(student.values()) / len(student)
maximum = max(student.values())
minimum = min(student.values())
print(f"平均分：{avg:.2f}")
print(f"最大值：{maximum}")
print(f"最小值：{minimum}")
name = input("请输入学生名字：")
if name in student:
    score = student[name]
    print(f"{name}同学的分数为：{score}")
    if score > avg:
        print("该生成绩属于上等水平")
    elif score == avg:
        print("该生成绩属于中等水平")
    else:
        print("该生成绩属于下等水平")
else:
    name not in student
    print("请输入正确的学生名字")
